<template>
  <view>
    <view style="position: fixed;left: 0;width: 100%; top:0;z-index: 1;">
      <view class="" style="background-color: #71c867;">
        <bar></bar>
        <view class="gui-flex gui-nowrap gui-rows gui-align-items-center">

          <view class=" gui-padding" style="padding-top: 10rpx;">
            <text class="gui-h4 gui-bold gui-color-white">商户</text>
          </view>

          <gui-mp-navigation-spacing></gui-mp-navigation-spacing>
        </view>
      </view>
      <view class="header gui-border-b gui-border-box gui-bg-gray">
        <gui-switch-navigation :size="180" :currentIndex="currentIndex" :items="tabs" activeDirection="center"
          textAlign="center" @change="navchange"></gui-switch-navigation>
      </view>
    </view>

    <view>
      <bar></bar>
      <view style="height: 80rpx;">

      </view>

    </view>
    <view class="gui-margin-top">
      <gui-article-list :articles="articleList" @newstap="newstap" :baseUrl="baseUrl"></gui-article-list>
    </view>
  </view>
</template>

<script>
  export default {

    data() {
      return {
        baseUrl: uni.gRequest.file,
        articleList: []
      }
    },
    onLoad() {
      this.initData();
    },
    methods: {
      initData() {
        uni.gRequest.get('news/list', {
          type: 1
        }).then(result => {
          // console.log('result123', result);
          this.articleList = result.rows;
          this.articleList.forEach(x => {
            x.title = x.headline;
            x.imgs = x.image.split(',');
          });
          // console.log(this.articleList)
        });
      },
      newstap(id) {
        console.log(id);
      }
    }
  }
</script>

<style>

</style>
